package com.youlu.campus.service.app.impl;

import com.youlu.campus.entity.AppUserPO;
import com.youlu.campus.service.app.AppUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class AppUserServiceImpl implements AppUserService {
    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public AppUserPO findByOpenId(String appId, String openId) {
        Query query = new Query().addCriteria(Criteria.where("openId").is(openId));
        AppUserPO appUserPO = mongoTemplate.findOne(query, AppUserPO.class);
        return appUserPO;
    }
}
